@extends('admin.layout')
@section('body')
    <!-- 正文开始 -->
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-card-body">
                <!-- 表格工具栏 -->
                <form class="layui-form toolbar" id="formSearch">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">@lang('common.keyword'):</label>
                            <div class="layui-input-inline">
                                <input name="keyword" class="layui-input"
                                       placeholder="@lang('job.article.keyword_placeholder')"/>
                            </div>
                        </div>
                        <div class="layui-inline">&emsp;
                            <button class="layui-btn icon-btn" lay-filter="searchForm" lay-submit>
                                <i class="iconfont icon-ic_search"></i>@lang('common.search')
                            </button>
                        </div>
                    </div>
                </form>
                <!-- 数据表格 -->
                <table id="adminTable" lay-filter="adminTable"></table>
            </div>
        </div>
    </div>
@stop
@push('script')
    <script type="text/html" id="imageTpl">
        <div style="max-width: 100px;max-height: 100px;">
            <img src="@{{ d.cover }}" alt="" onclick="SystemUtil.previewImg(this);">
        </div>
    </script>
    <script type="text/javascript">
        layui.use(['layer', 'form', 'table', 'util', 'admin'], function () {
            let listTableInc = new ListTable("{{admin_url($baseRoute.'pager')}}");

            @auth('create')
            listTableInc.topAddBar("{{admin_url($baseRoute.'create')}}", {
                title: "@lang('common.create')",
                area: ['750px', '700px']
            });
            @endauth
            @auth('edit')
            listTableInc.editBar((tb, d) => {
                SystemUtil.openUrl2({
                    title: "@lang('common.edit')",
                    content: "{{admin_url($baseRoute.'edit')}}/" + d.id,
                    area: ['750px', '600px']
                });
                SystemUtil.CurrentTableInc = tb;
            });
            @endauth
            @auth('delete')
            listTableInc.delBar(function (tb, d) {
                return SystemUtil.ajax("{{admin_url($baseRoute.'delete')}}").setData({id: d.id});
            });
            listTableInc.topBatchDeleteBar("{{admin_url($baseRoute.'batchDelete')}}");
            @endauth
            listTableInc.checkbox();
            listTableInc.lineNumber();
            listTableInc.column("@lang('common.id')", "id").setWidth(100);
            listTableInc.column("标题", "title");
            listTableInc.column("封面", "cover").tpl('#imageTpl');
            listTableInc.column("专业", "specialty_text");
            listTableInc.column("行业", "industry_text");
            listTableInc.column("城市", "city_text");
            listTableInc.column("@lang('common.created_at')", "created_at");
            listTableInc.column("@lang('common.updated_at')", "updated_at");
            listTableInc.rowBarWidth = 100;
            listTableInc.render();
            window.listTableInc = listTableInc;
        });
    </script>
@endpush
